package com.jubao.ejb.entity;

import java.io.Serializable;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

@Entity
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE, region = "ContentCache", include = "all")
@Table(name = "product_tbl", schema = "jubao_database", uniqueConstraints = {})
//@NamedQueries( { @NamedQuery(name = "Product.eql.findContentLeafCategoryBy", query = "SELECT c2g FROM  Content2Category  c2g where  c2g.content.sysId=:contentSysId AND c2g.relationId=:relationId AND c2g.category.typeId=:categoryTypeID AND c2g.category NOT IN (select g.primaryParent FROM Category g where g.primaryParent=c2g.category)") })
public class Product extends GeneEntity implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 8031513597354666951L;

	@Column(nullable = false, unique = true, updatable = false)
	private String id; // unique

	@Column(nullable = false)
	private String name;

	private String fullName;

	private String smallImage;

	private String mediumImage;

	private String largeImage;

	private Double listPrice = new Double(0);

	@Basic(fetch = FetchType.LAZY)
	@Column(length = 512)
	private String shortDesc;

	@Basic(fetch = FetchType.LAZY)
	@Column(length = 2048)
	private String longDesc;

	@Basic(fetch = FetchType.LAZY)
	@ManyToOne
	Category primaryCategory;

	@Basic(fetch = FetchType.LAZY)
	@ManyToOne
	Brand brand;

	@Basic(fetch = FetchType.LAZY)
	@ManyToOne
	User supplier;

	/**
	 * @return the id
	 */
	public String getId() {
		return id;
	}

	/**
	 * @param id the id to set
	 */
	public void setId(String id) {
		this.id = id;
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @return the fullName
	 */
	public String getFullName() {
		return fullName;
	}

	/**
	 * @param fullName the fullName to set
	 */
	public void setFullName(String fullName) {
		this.fullName = fullName;
	}

	/**
	 * @return the smallImage
	 */
	public String getSmallImage() {
		return smallImage;
	}

	/**
	 * @param smallImage the smallImage to set
	 */
	public void setSmallImage(String smallImage) {
		this.smallImage = smallImage;
	}

	/**
	 * @return the mediumImage
	 */
	public String getMediumImage() {
		return mediumImage;
	}

	/**
	 * @param mediumImage the mediumImage to set
	 */
	public void setMediumImage(String mediumImage) {
		this.mediumImage = mediumImage;
	}

	/**
	 * @return the largeImage
	 */
	public String getLargeImage() {
		return largeImage;
	}

	/**
	 * @param largeImage the largeImage to set
	 */
	public void setLargeImage(String largeImage) {
		this.largeImage = largeImage;
	}

	/**
	 * @return the listPrice
	 */
	public Double getListPrice() {
		return listPrice;
	}

	/**
	 * @param listPrice the listPrice to set
	 */
	public void setListPrice(Double listPrice) {
		this.listPrice = listPrice;
	}

	/**
	 * @return the shortDesc
	 */
	public String getShortDesc() {
		return shortDesc;
	}

	/**
	 * @param shortDesc the shortDesc to set
	 */
	public void setShortDesc(String shortDesc) {
		this.shortDesc = shortDesc;
	}

	/**
	 * @return the longDesc
	 */
	public String getLongDesc() {
		return longDesc;
	}

	/**
	 * @param longDesc the longDesc to set
	 */
	public void setLongDesc(String longDesc) {
		this.longDesc = longDesc;
	}

	public Category getPrimaryCategory() {
		return primaryCategory;
	}

	public void setPrimaryCategory(Category primaryCategory) {
		this.primaryCategory = primaryCategory;
	}

	/**
	 * @return the brand
	 */
	public Brand getBrand() {
		return brand;
	}

	/**
	 * @param brand the brand to set
	 */
	public void setBrand(Brand brand) {
		this.brand = brand;
	}

	public User getSupplier() {
		return supplier;
	}

	public void setSupplier(User supplier) {
		this.supplier = supplier;
	}

}
